#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      mcorrea
#
# Created:     02/04/2012
# Copyright:   (c) mcorrea 2012
# Licence:     <your licence>
#-------------------------------------------------------------------------------

class Stack:
    def __init__(self, start=[]):
        self.stack = []
        for x in start:
            self.push(x)
        self.reverse()

    def push(self, x):
        self.stack = [x] + self.stack

    def pop(self):
        if not self.stack:
            return
        top = self.stack[0]
        del self.stack[0]
        return top

    def empty(self):
        return not self.stack

    def _len_(self):
        return len(self.stack)

    def __getattr__(self, name):
        return getattr(self.stack, name)

class error(Exception):
    pass


def main():
    s = Stack();
    s.push(1)
    s.push(2)
    s.push(3)

    print s.pop()
    print s.pop()
    print s.pop()
    print s.pop()

if __name__ == '__main__':
    main()
